package personal.xjl._23java1studentdemo.spring;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;


@Aspect
@Component("myAnotherAdvice")
public class MyAnotherAdvice {
    @Before("execution(* MyMath.add())")
    public void before(){
        System.out.println("我的另一个前置增强");
    }
    @After("execution(* MyMath.sub())")
    public void after(){
        System.out.println("我的另一个后置增强");
    }
    @Around("execution(* MyMath.mul())")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("另一个环绕增强开始了");
        Object result = pjp.proceed();
        System.out.println("另一个环绕增强结束了");
        return result;
    }
}
